#include "CProduction_If.h"
#include "Expression.h"
#include "Statement_If.h"
#include "Statement_List.h"

CTokenPtr CProduction_If::Reduce( CProductionArgPtr pArgs )
{
	CExpressionPtr pExp = pArgs->getArg<CExpression>(3);

	CStatementListPtr pStatmentList = pArgs->getArg<CStatementList>(5);

	CStatementIfPtr pIfStatement = CTokenFactory::createToken<CStatementIf>();

	pIfStatement->m_pExp = pExp;

	pIfStatement->m_pStatement = pStatmentList;

	pIfStatement->eval();

	return pStatmentList;
}